package org.example.chat.client;

import java.util.HashMap;
import java.util.Map;

public class ManageClientThreadConnectServer {

    /**
     * static：修饰的变量在类加载时就会被初始化
     * 非静态变量：每次创建对象时都会初始化一次，且各个初始化后的对象副本均互不受影响
     */
    public static HashMap<String,ClientThreadConnectServer> cm = new HashMap<>();

    //add
    public void addClientThreadConnectServer(String userId,ClientThreadConnectServer clientThreadConnectServer){
        cm.put(userId,clientThreadConnectServer);
    }

    //query
    public ClientThreadConnectServer getClientThreadConnectServer(String userId){
        return cm.get(userId);
    }

}
